<?php

class TagTable extends Doctrine_Table
{
    /**
     * Retrieves all the tags with the number of times they are attached to
     * a bookmark (weight).
     */
    public function retrieveTagsWithWeight()
    {
        $q = $this->createQuery('bt')
                ->select('bt.*, count(bt.id)')
                ->groupBy('bt.name')
                ->orderBy('bt.name ASC');

        return $q->fetchArray();
    }
}